Exploring Smartphone Influence on the Brain: Neurological Perspectives
Angular vs. React: Which One Should You Choose?
Discover Serenity: Your Guide to Mindfulness Apps
Discover how smartphone apps can enhance your mindfulness practice: 5 Senses Exercise with Apps
Discover How Smartwatches Measure Blood Pressure: Explained Simply
13 Exciting Games Launching in April 2024: From Freedom Planet 2 to TopSpin 2K25!
Discover the 5 Amazon Big Spring Deals on Tablets from Samsung, Lenovo
Big Savings Alert: Amazfit Smart Watches Now on Sale on Amazon!
Amazon's Big Spring Sale: Top 6 Anker Souncore Headphones and Earbuds Deals
Affordable VR Adventures: The Best Budget VR Headsets
Fly in Peace: Discover the Ultimate Noise-Cancelling Headphones for Flying
Bringing AI to Life: NVIDIA's Digital Human Technolgies in Healthcare, Gaming, and More
Discover Exciting New Games on NVIDIA GeForce NOW!
Steam Spring Sale 2024 is here: Explore the 10 Best FPS Games
The Future of iPhones: Apple's Bold Step into AI with DarwinAI
Discover the Magic of Sonos Soundbar: Transform Your Home Entertainment Experience!
Enhance Your Home Fun: 5 Best Sonos Soundbars to Amp Up Your Entertainment!
Pinterest Introduces AI-Powered Body Type Ranges for Inclusive Searches
Embrace the Next Wave: 35+ AI Tools for Enhanced Productivity in 2024
Xbox Gaming Bonanza: Lots of New Games with Xbox Game Pass!
Sony Paves the Way for Gaming Evolution with 'Super-Fungible Tokens' Patent
Smart Printing Choices: 10 Key Factors to Consider When Buying an HP Printer or Any Printer
Projector Picks: Explore the Best Mini Projectors for Big Screen Fun!
JavaScript Essentials: Your Quick Start to Web Coding
Gaming Laptop Guide 2024: 10 Crucial Checks Before You Buy + Top 5 Picks for you!
Gaming Joy Awaits: Explore the Best PS5 Games of 2024
Epic Games Special: Dive into Astro Duel 2 for FREE this week. See What’s Coming Next Week!
Fitbit Fitness Tracker Guide 2024: Choose Your Perfect Fit
Feel the Beat: Exploring Top Over-Ear Headphones
Explore the Web Development Strategies in 2024: A Developers Handbook
Explore Must-Play Nintendo Switch Games in 2024!
Eclipse Ready: CE and ISO Certified Solar Eclipse Glasses for a Safe Sky Spectacle
Disney and Pixar’s Inside Out 2 Introduces New Emotions to Riley's World
Discover Waze's cool new features for safer and happier drives!
Discover the Top Picks: Best Smartwatches for Your Lifestyle
Discover the Best Smartphones Trending Now: Your Easy Guide to the Best Picks!
Sound Revolution: Discover the Best Bluetooth Speakers of 2024!
Discover the 10 Best Productivity Apps to Supercharge Your Daily Tasks
Discover,Install and Enjoy: The Best Chrome Extensions for Developers in 2024
Crack the Code: Your Guide to Computer Programming Magic in 2024
Boost Your Content Creation: 10 ChatGPT Prompts to Supercharge Content Creation Productivity
10 Best Tech Companies in Silicon Valley
Top 10 Web Development Interview Questions you can...
Learn how to Answer Tell me about Yourself
5 Books You Need to Read Right Now
25 Practical Ways to Earn Money Online
Translate this page in your preferred language:
Article by: Manish Methani
Last Updated: October 3, 2021 at 2:04pm IST
In this article, you will find the last-minute notes of Data Structures useful in the preparation of the GATE CSE exam.
Easy to remember Short formulas used for solving the problems is the bonus for you.
An array is a data structure used to store values of the same type.
Array declaration by specifying its size int arr[10]; Initialise elements in an array int arr[] = {2,4,6,7}; Specify size and initialise elements int arr[5] = {2,4,6,8,10};
Length of Array = UB - LB + 1
How to find the address of any element with the given address of the first element in an array,
Loc (arr [i]) = base (arr) + size * i size = size is the number of bytes required to store a single element of the array arr. i = index of an array whose address we want to calculate
Elements of two-dimensional arrays (m X n) are stored in two ways:
Column major order: If an array is declared by a[m][n] where m is the number of rows while n is the number of columns, then the address of an element a[i][j] of the array stored in column-major order is calculated as,
The formula is:
LOC (arr [i, j]) = Base Address + [(i - Lr) + nr(j - Lc)]*datatype size
Here,
LOC (arr [i,j]): is the location of the element in the ith row and jth column.
Base (arr): is the base address of the array arr.
nc => number of columns in the main array.
nr => number of rows in the main array.
Lr => Lower bound of base array row.
Lc => Lower bound of base array column.
Row major order: If the array is declared by a[m][n] where m is the number of rows while n is the number of columns, then the address of an element a[i][j] of the array stored in row-major order is calculated as,
LOC (arr [i, j]) = Base Address + [nc(i - Lr) + (j - Lc)]*datatype size
Here,
LOC (arr [i,j]): is the location of the element in the ith row and jth column.
Base (arr): is the base address of the array arr.
nc => number of columns in the main array.
nr => number of rows in the main array.
Lr => Lower bound of base array row.
Lc => Lower bound of base array column.
Stack is a linear data structure in which operations are performed in two ways.
1) LIFO (Last In First Out)
2) FILO (fIRST INLAST OUT)
Basic operations :
Infix notation: X + Y Operators are written in-between their operands. This is the usual way we write expressions. An expression such as
A * ( B + C ) / D
Postfix notation (also known as “Reverse Polish notation”): X Y + Operators are written after their operands. The infix expression given above is equivalent to
A B C + * D/
Prefix notation (also known as “Polish notation”): + X Y Operators are written before their operands. The expressions given above are equivalent to
/ * A + B C D
1. It is a classic problem where you try to move all the disks from one peg to another peg using only three pegs.
2. Only one disk will be shifted at a time.
3.Smaller disk can be placed on the larger disk.
The time complexity to find the order of moves of discs in the Tower of Hanoi problem is O(2^n).
A queue is a linear structure in which the first element is inserted from one end called the REAR(also called the tail), and the removal of the existing element takes place from the other end called FRONT(also called the head).
The order which queue follows is First In First Out (FIFO).
Enqueue: Adds an item to the queue.
Dequeue: Removes an item from the queue.
Algorithm for DEQUEUE operation
The linked list is a linear data Structure used to store elements dynamically. No need to know the actual size. In the case of arrays, you must know the size of an array. Linked List in Data Structure gives better advantages than arrays.
The difference between Array and the Linked list is explained here by the advantages of Linked List over Arrays.
1) Dynamic size
2) Insertion/Deletion is easy in Linked List.
1) Random access is not allowed. We have to access elements sequentially starting from the first node. So we cannot do a binary search with linked lists.
2) Extra memory space for a pointer is required with each element of the list.
Representation in C: A linked list is represented by a pointer to the first node of the linked list. The first node is called the head. If the linked list is empty, then the value of the head is NULL.
Test your C Programming skills with this comprehensive mock test on C Programming.
Take TestSolve most asked Interview Questions on Flutter and Test your foundational skills in flutter.
Take TestSolve most asked GATE Questions in Operating Systems and test your Gate Score.
Take TestThis is a mock test designed to help you assess your knowledge and skills in HTML and CSS.
Take TestSolve most asked GATE Questions in Data Structures and Algorithms and test your Gate Score.
Take Test