Recent posts in Programming & Data Structures



Day Date Contents Slides Assignments
1 Aug 1 Introduction to C Programming: A system overview - How a C program works in a Computer? 
Call by Value Parameter Passing in Use
Chapter 1   
2 Aug 2 Datatypes - implicit/explicit type conversion, Comparison between signed and unsigned, char and int
Constants - (suffix - L for long,f for float; prefix - 0 for octal, 0x for hexadecimal), enum, 
string literals, comparison between float and double
Variables scopes and lifetimes - global, static, auto and their memory allocation
Stack, Code and Data Segment,
Format specifiers for important types.
Little Endian and Big Endian - how to check
Introduction to Pointers - size of pointer, its type
Live programming sessions
Chapter 2 Practise Questions
3 Aug 3 Pointer Arithmetic- valid and invalid pointer operations, size of array using pointer,
Optimisation during compilation of code, why argument is passed as address in scanf function?, Modify value at any address using pointers(only char and void pointer can be used),
Array is a constant pointer?, the type of an array
General formula for pointer plus integer value(unsigned),Trial and error method of learning 
more on pointers(address and values of pointer variables in array),
Valid and invalid address that can be stored in a pointer, Null pointer,
Program on printing IEEE 754 representation of a number
Chapter 3 Practise Questions
 4  Aug 4  More on arrays and pointers. Multi-Dimensional array address calculation, detailed study on type
 and size of arrays and pointers, loss of dimension when array is passed to a function, 
Structure and union- user defined datatypes, size of structure and union(coding),structure padding
 Declarations in C  
 5  Aug 5 No discussion- solving previous Gate questions on C programming    
 6  Aug 6 Scope and lifetime of variables, atoi() function, malloc function- free(), double free corruption,
switch case- variable used in switch(constants), hashing used for optimisation, No performance advantage of switch case currently- branch prediction accuracy
 7  Aug 7 l-value and r-value, comma operator, Bitwise and logical operators- sequence point    


Day Date Contents Slides Assignments
 1  Aug 7 Introduction to data structures- stack, array, queue, linked list
 2  Aug 8 No discussion, Assignments on data structures    Assignment-1
 3  Aug 9 Implementation of stack using array, queue using two stack, stack using two queues, 
Linked list- Advantages and disadvantages of array and linked list implementation,
insertion and deletion- time complexity, doubly linked list, tree traversals- preorder, inorder, postorder,
Binary search tree
 4  Aug 10 Binary trees- strict, complete, full, balanced, Height/level of a binary tree, Storing parent pointer in a node,
Max and min heap-implementation, kth largest element in a heap, Binary search tree, Tree implementation
 5  Aug 11 No discussion, Assignment on linked list, binary search tree   Assignment-4
Assignment 5

For more information visit GO Classroom:

Manoja Rajalakshmi A posted in Programming & Data Structures Sep 17, 2018 retagged Sep 17, 2018 by Manoja Rajalakshmi A

off topic here:

There is a lot variation of tree QS + c_programming QS in gate using recursion:

I found it helpful to run all those and test the correctness of them and try different variations using minor modifications in the questions.

To do that, we need a tree data structure at first and we need to build it using C language because in gate we are most concerned with C only

Constructing a tree is OK ! and running those programs are also fine! but to check it manually we must need to use pen/paper to trace all node after drawing the given tree. And if further nodes are added or leaves are added then tree structure changes and manual checking becomes a little bit lengthy. 



a few weeks back, I wrote a tree program and trying to visualize it while executing the executable in C lang.

I went though few posts in StackOverflow and found a nice way to do in c++. 

I downloaded the source and modified it to our requirement so that while writing our questions we need to worry about c++ issues and advanced functions.

at present in the modified code: we can do the following operations:

  1. add nodes directly using left and right pointers.
  2. write the required function func()
  3. and call a func(root)
  4. That func() you must write to some task : Like finding height using recursion / Or finding no of nodes using recursion.
  5. No need to initialize the tree + No need to de_allocate + No need to worry any other stuff (all are taken care of in the code)

I commented the code and clearly pointed out the portions:

  • where  we need to write code to add the nodes (as required in a particular question)
  • where we need to write the problem specific function (as required in a particular question)



For example writing height_function():




Where to add nodes and how?



Here giv_new is predefined macro which will give us a random number where the range you can modify as your wish in the program starting few lines #define giv_new rand()%107. just change the $107$ to something you max need.


Before doing these we must need to update GCC to 5.1.


Just install TDM-GCC according to your system (x86 / x64)

  • double click install- no need to set path and other modifications
  • After installing gcc or g++ directly available to you command prompt in windows.

This the source file : save in a folder say . abc

  • navigate to the saved folder abc  using the command prompt.
  • g++ -std=c++11 filename.cpp is the command to compile the program.
  • run it : a.exe if you want to see the results directly in the present command prompt.
  • Or run it: a.exe > outfilename.txt . outfilename.txt will be created in the same folder.
  • You can view that text file in a nearby window simultaneously.(better for large tree)

Although the program is available in c++, to practice our question we don't need to worry about c++ stuff just plain c would work. Few exceptions might be there : I hope you can handle those :) 

If you are using a better editor like sublime: you can collapse (toggle) unnecessary codes and can focus only on the codes you need.

Like this:

dd posted in Programming & Data Structures Jan 13, 2017 edited Jan 13, 2017 by dd
by dd


Anil Khatri posted in Programming & Data Structures Aug 28, 2016

Refer the above two links for the materials. Also do follow this blog for GATE 2017 (we won't be using moodle any more). I'll be adding some exercises as comments. Most exercises for this subject will be programming ones. 

Arjun posted in Programming & Data Structures Mar 17, 2016
by Arjun

Important Ones

More Questions

Topic Source Link Solution
Linked Lists IITKgp  Assignment- IA Linked Lists   Solutions
Stack, Queue IITKgp Assignment- IB Stack Queue Solutions
Binary Trees IITKgp Assignment- IC Binary Trees Solutions
Arrays, Sets and Hash-tables IITKgp Arrays, Tables and Set NA
B+ Trees IITKgp B+tree NA
Graphs IITKgp Graphs NA



Arjun posted in Programming & Data Structures Jul 29, 2015
by Arjun
To see more, click for the full list of questions or popular tags.