Lesson 1 Flashcards
4 Definitions of Data Structures
Data structure is a representation of data and the operations allowed on that data.
A data structure is a way to store and organize data in order to facilitate the access and modifications.
Data Structure are the method of representing of logical relationships between individual data elements related to the solution of a given problem.
a data structure is a way of organizing all data items that considers not only the elements stored but also their relationship to each other.
Define Algorithm
An ALGORITHM is a step by step procedure to solve a particular function
Define Algorithm and Data Structure
Therefore, an algorithm is a set of instruction written to carry out certain tasks & the data structure is the way of organizing the data with their logical relationship.
Why learn Data structures and algorithms?
Data Search
Processor speed
Multiple requests
Data Structure graph
Data strucutres
├───Non-Primitive
│ ├───Linear
│ │ ├───Dynamic
│ │ │ ├───Linked Lists
│ │ │ ├───Queues
│ │ │ └───Stacks
│ │ └───Static
│ │ └───Arrays
│ └───Non-linear
│ ├───Graphs
│ └───Trees
└───Primitive
7 Primitive Data Structures
Integer
Character
Boolean
Floating Point
Double Floating Point
Void
Wide Character
Linear Data Structures
elements arranged in sequential manner
each member element is connected to its previous and next element.
easy to implement as computer memory is also sequential
Non-linear Data Structures
has no set sequence of connecting all its elements and each element can have multiple paths to connect to other elements
supports multi-level storage and often cannot be traversed in single run.
not easy to implement but are more efficient in utilizing computer memory.
DYNAMIC DATA STRUCTURES
designed to facilitate change of data structures in the run time and the size can be randomly updated during run time.
STATIC DATA STRUCTURE
has fixed memory size and Memory size is known before run time.
Link list
elements are not stored at contiguous location; the elements are linked using pointers.
Each node of a list is made up of two items - the data and a reference to the next node. The last node has a reference to null.
Stacks
Collection with access only to the last element inserted
Last in first out policy
Queues
collection with access only to the item that has been present the longest,
implements Last in last out or first in first out policy
TREE
A tree data structure can be defined recursively as a collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of references to nodes (the “children”), with the constraints that no reference is duplicated, and none points to the root.
GRAPH
A graph is a group of vertices and edges where an edge connects a pair of vertices whereas a tree is considered as a minimally connected graph which must be connected and free from loops.