Data Structures Flashcards
What is a data structure?
It is a group of data elements that provide an efficient way to store and organize data in the computer.
What are some applications of data structures?
programs, graphics, and operating systems.
Why is it necessary to use data structures?
As the data and complexity of applications increase the following issues can occur, which can be fixed with the help of data structures.
Acronym: My Dear Paulie
Multiple requests: If thousands of users are requesting data from a web server at the same time, then there is a high probability that the webserver fails
DataSearch: If large amounts of data are stored, searching through it will mean traversing every piece of data.
Processor speed: high processor speeds are required to handle large amounts of data, as this data increases, if it is not stored efficiently, the processor may fail.
What are the advantages of data structures?
Acronym: EAR
Efficiency: The efficiency of a program depends on the data structures it uses. E.g searching through an array vs a binary search tree
Abstraction: Data structures are identified by their abstract data types, which provide a level of abstraction.
Re-usability: Once implemented data structures can be used multiple times, or packed into libraries to be used by other users or clients
how are data structures classified? (draw diagram)
Primitive:
-> int, char, bool
non-primitive:
linear:
static:
-> arrays
dynamic:
-> Queues, Stacks, Linked list
non-linear:
->trees and graphs
what is a linear data structure?
This is a data structure whose data is organized in a linear or non-hierarchical manner.
State and explain the types of linear data structures.
Static:
Array: It is a collection of similar elements of the same datatype that share the same variable name but differ in indexes
Dynamic:
LinkedList: It is a collection of nodes stored in non-contiguous memory, each node containing a pointer to its adjacent node
Stacks: It is a list of data elements where insertion and deletion can only be done at one end of the list called the top.
Queues: It is a list of data elements where insertion can only be done on one end(rear) and deletion can only be done at the other one(front)
What is a non-linear data structure?
It is a data structure whose elements are arranged in a non-linear manner, where elements are linked to each other in a hierarchical manner.
State and explain the types of non-linear data structures.
Trees: It is a collection of nodes arranged in a hierarchical manner where the topmost node is called the root node, and the bottom-most nodes are called the leave nodes. Every node can have multiple child nodes except a leave node and Every node can have 1 parent node except the root node.
Graphs: It is a pictorial representation of a set of elements, represented by vertices. It differs from a tree in that it can contain cycles.
What are the possible operations that can be performed on data structures?
Acronym: MIDSST
Merging: It is when lists of varying sizes are combined to form a new list.
Insertion: It means adding a data element to a data structure.
Deletion: It means removing a data element from a data structure.
Searching: It means finding the location/index of a particular element in a data structure
Sorting: It means arranging the elements in a data structure in a particular order.
Traversing: It means visiting every element in a data structure to perform an operation