Introduction To Data Structures and Algorithms with JavaScript 
Tags: javascript, webdev, beginners, programming
Published: 2022-02-21 19:17:08

**Data Structures**
**Python Data Structures** – 
**Tuples**
A tuple is a built-in data structure in Python that is an ordered collection of objects. The primary differing characteristic between lists and tuples is mutability. Lists are mutable, whereas tuples are immutable. Tuples cannot be modified, added, or deleted once they’ve been created. Lists are defined by using parentheses to enclose the elements, which are separated by commas.
The use of parentheses in creating tuples is optional, but they are recommended to distinguish between the start and end of the tuple. A sample tuple is written as follows:
tuple_A = (item 1, item 2, item 3,…, item n)
Tuples are preferred when the user does not want the data to be modified. Use less memory
**Sets**
A set is defined as a unique collection of unique elements that do not follow a specific order
they can be modified, added, replaced, or removed. A sample set can be represented as follows:
set_a = {“item 1”, “item 2”, “item 3”,….., “item n”}


List
A list is defined as an ordered collection of items, and it is one of the essential data structures when using Python to create a project
re just like the arrays, declared in other languages which is an ordered collection of data. It is very flexible as the items in a list do not need to be of the same type.
The costly operation is inserting or deleting the element from the beginning of the List as all the elements are needed to be shifted. Insertion and deletion at the end of the list can also become costly in the case where the pre-allocated memory becomes full.
List = [1, 2,  3, "GFG", 2.3]
print(List)
In python starting index of the list, sequence is 0 and the ending index is (if N elements are there) N-1

**Python Dictionary**
in Python is an unordered collection of data values, used to store data values like a map, which, unlike other Data Types that hold only a single value as an element, Dictionary holds key:value pair
In Python, a Dictionary can be created by placing a sequence of elements within curly {} braces, separated by ‘comma’. Dictionary holds pairs of values, one being the Key and the other corresponding pair element being its Key:value.
Dict = {1: 'Geeks', 2: 'For', 3: 'Geeks'}

Python are immutable objects that only support methods and operators that produce a result without affecting the frozen set or sets to which they are applied. While elements of a set can be modified at any time, elements of the frozen set remain the same after creation.
If no parameters are passed, it returns an empty frozenset
frozenset({'g', 'e', 'f'})

**String**
Python Strings are arrays of bytes representing Unicode characters. In simpler terms, a string is an immutable array of characters
Bytearray
Python Bytearray gives a mutable sequence of integers in the range 0 <= x < 256.
Example: Python Bytearray Operations
# Creating bytearray
a = bytearray((12, 8, 25, 2))

Advanced Data structures are one of the essential branches of data science which is used for storage, organization and management of data and information for efficient, easy accessibility and modification of data

**Primitive types**
Primitive types are either a basic building block or are a built-in type support function
Boolean data type– A Boolean data type is a computer-science related algorithm where there are only two possible values of the function- true and false
Composite or non-primitive type
Array- It is a collection of elements identified by a key or array index.
b) Records- It is structured data usually in the form of rows.
c) Union- They are a collection of several representations. 
Abstract data types
In this data type, the behaviour is analyzed from the point of view of the user. The further list includes the following-
a) Container- This has a collection of the variable for problem-solving.
b) List- This includes ordered values of countable values
c) Graph- It represents pictorial representation of data for better understanding and evaluation.
d)Other abstract data types include tuple, multimap, set, multiset, stack, queue, double-ended queue. 

**Linear Data Structures**
A data structure is linear if the imageelements of that data structure form a linear pattern or sequence.
Control table
Image
Matrix
Lists
Tree types
Tree types include the main head (parent node) and then the branches (nodes) are divided based on subcategories and are further divided. This continues until all the elements have been allocated properly in their branches.
Binary trees- In this tree function, there is a maximum of two sub-nodes. They are referred to as a left child and a right child.
b) Decision trees- This tree is a systematic analysis of the possible consequences, events, outcomes to display an algorithm.
Graphs
A pictorial representation of data for better understanding purposes.
a) Multigraph- it is permitted to have multiple edges which may have an identity and may not have an identity.
b) Adjacency matrix- This is used for representing finite graphs.