Data Structures rounds out the “Basics of Mechatronics” section (A.2) of the GATE Robotics and Automation (RA) 2027 syllabus and connects directly to the programming and automation software that robotics runs on. The examined structures are the stack, queue, linked list, binary search tree, binary heap and graph, and the questions test their operations, ordering and complexity. This guide reviews each and works through six GATE-style problems in full.
TABLE OF CONTENTS
Stacks & queues
A stack is a last-in-first-out (LIFO) structure with push and pop at one end — used for function calls, undo, and postfix expression evaluation. A queue is first-in-first-out (FIFO), with enqueue at the rear and dequeue at the front — used for scheduling and breadth-first search. Both offer O(1) insertion and removal.
Linked lists
A linked list stores elements in nodes, each holding data and a pointer to the next node. Unlike arrays, insertion and deletion are O(1) once the position is known, but random access is O(n) because you must walk the chain. Doubly and circular linked lists add backward and wrap-around links.
Binary search trees
A binary search tree (BST) keeps every left child less than its parent and every right child greater, so an in-order traversal visits the keys in sorted order. Search, insert and delete run in O(h) time, where h is the height — O(log n) if balanced, O(n) in the worst (skewed) case. A binary tree of height h holds at most 2h+1 − 1 nodes.
Serious about GATE RA 2027? Get structured video lectures, PYQs, notes and a full test series — taught by Piyush Wairale (IIT Madras).
Binary heaps
A binary heap is a complete binary tree stored in an array, satisfying the heap property (in a max-heap every parent ≥ its children). Using 1-based indexing, the node at index i has children at 2i and 2i+1 and parent at ⌊i/2⌋. Insertion and extraction are O(log n), which makes heaps the basis of priority queues and heap-sort.
Graphs
A graph is a set of vertices connected by edges, stored as an adjacency matrix or adjacency list. A complete graph on n vertices has n(n−1)/2 edges (undirected). Traversals use breadth-first search (a queue) and depth-first search (a stack or recursion), the backbone of path-planning in robotics.
Worked examples (GATE-style)
Example 1 — postfix evaluation (stack)
Evaluate the postfix expression 2 3 4 * + using a stack.
Solution. Push 2, 3, 4. On *: pop 4 and 3 → 12, push it. On +: pop 12 and 2 → 14.
Result = 14 (i.e. 2 + 3×4).
Example 2 — edges in a complete graph
How many edges does a complete undirected graph on 6 vertices have?
Solution. Edges = n(n−1)/2 = 6×5/2 = 30/2.
= 15 edges.
Example 3 — maximum nodes in a binary tree
What is the maximum number of nodes in a binary tree of height 3 (root at height 0)?
Solution. Maximum nodes = 2h+1 − 1 = 24 − 1 = 16 − 1.
= 15 nodes.
Example 4 — heap array indices
In a binary heap stored with 1-based indexing, what are the array indices of the children of the node at index 3?
Solution. Children of index i are at 2i and 2i+1, so for i = 3 they are 6 and 7.
Children at indices 6 and 7.
Example 5 — BST in-order traversal
Keys 5, 3, 8, 1, 4 are inserted into a binary search tree. What does an in-order traversal output?
Solution. An in-order traversal of a BST always yields the keys in ascending sorted order.
Output = 1, 3, 4, 5, 8.
Example 6 — queue order
Items A, B, C are enqueued in that order, then one item is dequeued. Which item is removed, and what remains at the front?
Solution. A queue is FIFO, so the first item enqueued (A) is dequeued first.
Removed = A; new front = B.
Quick reference
QUICK REFERENCE
Stack / Queue: LIFO / FIFO, O(1) ops
Linked list: O(1) insert, O(n) access
BST: in-order = sorted, search O(h)
Binary tree: max nodes = 2h+1 − 1
Heap (1-based): children 2i, 2i+1; parent ⌊i/2⌋
Complete graph: edges = n(n−1)/2
Common mistakes to avoid
- Swapping LIFO and FIFO — a stack reverses order, a queue preserves it.
- Using 0-based heap formulas with a 1-based array (or vice versa) — children are 2i, 2i+1 for 1-based, 2i+1, 2i+2 for 0-based.
- Confusing height and depth conventions when counting maximum nodes.
- Forgetting a BST’s worst case — a skewed tree degrades search to O(n).
- Counting directed and undirected edges the same — a complete directed graph has n(n−1) edges.
GATE ROBOTICS & AUTOMATION 2027
Master Data Structures for GATE RA
Join the complete GATE RA course by Piyush Wairale (IIT Madras) — full syllabus coverage, PYQs, live doubt-clearing and an exam-focused test series that turns tough topics into guaranteed marks.
Basics of Mechatronics — full solved-problem series
This guide is one part of the Section A.2 (Basics of Mechatronics) solved-problem series. Work through every sub-topic:
See also the umbrella guide, Basics of Mechatronics — Important Questions, and the complete GATE RA 2027 Syllabus.
Frequently asked questions
What is the difference between a stack and a queue?
A stack is last-in-first-out (LIFO): the most recently pushed item is popped first. A queue is first-in-first-out (FIFO): the earliest enqueued item is dequeued first. Stacks suit recursion and backtracking; queues suit scheduling and breadth-first search.
Why does an in-order traversal of a BST give sorted output?
Because a binary search tree keeps every left subtree smaller and every right subtree larger than the node, visiting left–root–right (in-order) naturally produces the keys in ascending order.
How many edges does a complete graph have?
A complete undirected graph on n vertices has n(n−1)/2 edges, since every pair of vertices is joined exactly once. For n = 6 that is 15 edges. A complete directed graph has twice as many, n(n−1).
This solved-problems guide is part of the complete GATE RA 2027 Syllabus overview and the Basics of Mechatronics syllabus guide.
Recent Post

GATE RA 2027 Python programming practice: data types and operators, conditionals and loops, functions, strings, lists and recursion — key concepts and six fully worked GATE-style output-prediction problems with solutions.

GATE RA 2027 Engineering Mechanics practice: free-body diagrams and equilibrium, friction and belt-pulley, trusses, and kinematics and dynamics of rigid bodies — key formulas and six fully worked GATE-style problems.

GATE RA 2027 Digital Circuits practice: Boolean algebra, multiplexers, encoders and decoders, flip-flops and counters — key formulas and five fully worked GATE-style problems with solutions.

GATE RA 2027 Network Elements practice: KCL/KVL, Thevenin and Norton, maximum power transfer, RC/RL transients, resonance and AC power factor — key formulas and six fully worked GATE-style problems with solutions.

GATE RA 2027 Machine Design and CIM practice: factor of safety, failure theories, fatigue and endurance limit, shaft design and manufacturing basics — key formulas and five fully worked GATE-style problems with solutions.

GATE RA 2027 Kinematics and Dynamics practice: mechanisms, gear trains, vibrations and natural frequency, gyroscopic couple and velocity analysis — key formulas and five fully worked GATE-style problems with solutions.
Learn Daily, Wherever You Are
Free lectures, exam updates, PYQ discussions, and job alerts — delivered through our YouTube channel and Telegram communities.


