Utsav
Gautam

  • Call
  • Mail
  • Web
  • Home
  • +91 6380959987
  • utsavgautam16@gmail.com
  • ug.com
  • Kathmandu, Nepal

Passionate about coding, I specialize in C programming and have a strong foundation in Data Structures and Algorithms (DSA). My projects reflect my problem-solving abilities, from implementing fundamental data structures like linked lists and binary trees to designing algorithms that tackle complex computations efficiently. I have explored both theoretical and applied aspects of DSA, finding efficient ways to work with stacks and queues, especially for postfix evaluations. My focus is on writing clean, efficient code, whether I’m managing memory dynamically or applying sorting and searching algorithms to real-world problems, continuously building skills to innovate in the field.

  • Twitter
  • Github
  • WhatsApp






The Most Interesting Thing to Me in DSA
One of the most fascinating aspects I encountered in DSA was applying the stack data structure to solve postfix expressions. Postfix calculations offer a unique approach to computation by arranging operators after their operands, which removes the need for parentheses and follows a straightforward, stack-based approach. By using a stack to evaluate expressions in this format, I could break down complex expressions into simpler, more manageable steps. This method deepened my understanding of stacks and highlighted how useful they are for simplifying and organizing computational tasks efficiently.

What have i learnt

Learned foundational concepts in data organization and algorithm efficiency, setting the groundwork for solving complex computational problems.
  • Structures
  • Structures using Pointers
  • Matrix Multiplication - Dynamic Memory allocation
  • Array Implementation of List
Explored linear data structures, including arrays and linked lists, and their applications in dynamic memory management.
  • Linked List
  • Doubly linked List
Implemented Last-In-First-Out (LIFO) and First-In-First-Out (FIFO) structures, essential for managing sequential data flow.
  • Stack using array and Linked List
  • Queue using array and Linked list
  • Applications of Stack and Queue
Studied hierarchical structures for data storage and retrieval, along with hashing techniques for efficient data access.
  • Tree using array
  • BST using linked list
  • B-Trees
Gained an understanding of graph theory, exploring nodes and edges for representing networks, paths, and relationships.
  • Graph using Array

Code:

          
            #include <stdio.h>
            #include <ctype.h>
            #include <string.h>
            
            #define MAX 100
            
            int stack[MAX];
            int top = -1,i=0;
            
            void push(int val) {
                if (top == MAX - 1) {
                    printf("Stack Overflow\n");
                } else {
                    stack[++top] = val;
                }
            }
            
            int pop() {
                if (top == -1) {
                    printf("Stack Underflow\n");
                    return -1;
                } else {
                    return stack[top--];
                }
            }
            
            int evaluatePostfix(char* exp) {
                int length = strlen(exp);  // Get the length of the expression
                for (i = 0; i < length; i++) {
                    char ch = exp[i];
            
                    // If the character is a digit, push it to the stack
                    if (isdigit(ch)) {
                        push(ch - '0');
                    }
                    // If the character is an operator, pop two elements from the stack and perform the operation
                    else {
                        int val1 = pop();
                        int val2 = pop();
                        switch (ch) {
                            case '+': push(val2 + val1); break;
                            case '-': push(val2 - val1); break;
                            case '*': push(val2 * val1); break;
                            case '/': push(val2 / val1); break;
                        }
                    }
                }
                return pop();  // Return the final result
            }
            
            int main() {
                int n;
                scanf("%d",&n);
            
                char input[n];
                scanf("%s",input);
                printf("Postfix Evaluation Result: %d\n", evaluatePostfix(input));
                return 0;
            }