CUITM205 Data Structures 2
CUITM205 Data Structures 2
CUITM205
What is a Data structure
• Data structure is a data organisation ,management and storage
format that enables efficient access and modification of data
• Processor Speed − Processor speed although being very high, falls limited if the data
grows to billion records.
To solve the above-mentioned problems, data structures come to rescue. Data can be
organized in a data structure in such a way that all items may not be required to be
searched, and the required data can be searched almost instantly.
Why do we need Data Structures
• Each data structure allows data to be stored in
a particular manner
• Data structures allow efficient data search and
retrieval
• Specific data structures work for specific
problems
• It allows management of large amounts of data
such as large databases and indexing services
such as hash tables
Characteristics of a Data Structure
• Correctness − Data structure implementation
should implement its interface correctly.
• Time Complexity − Running time or the
execution time of operations of data structure
must be as small as possible.
• Space Complexity − Memory usage of a data
structure operation should be as little as
possible.
Types of Data Structures
• Linear -the data items are arranged in a linear
sequence. Example: Array, Queue ,Stack etc
• Queue −
– isFull(), This is used to check whether queue is full or not
– isEmpty(), This is used to check whether queue is empty or not
– insert(x), This is used to add x into the queue at the rear end
– delete(), This is used to delete one element from the front end of the queue
– size(), this function is used to get number of elements present into the queue
• List −
– size(), this function is used to get number of elements present into the list
– insert(x), this function is used to insert one element into the list
– remove(x), this function is used to remove given element from the list
– get(i), this function is used to get element at position i
– replace(x, y), this function is used to replace x with y value