Programming concepts to crack interviews
Pre-workshop
Read fundamentals of computing (computer, assembler, compiler) here.
Click on examples to check the visualization of the code.
#include <stdio.h>
void swap(int a, int b) {
int temp;
temp = a;
a = b;
b = temp;
}
int main() {
int a = 5, b = 10;
printf("a = %d, b = %d\n", a, b);
swap(a, b);
printf("a = %d, b = %d\n", a, b);
swap(a+2, b+5);
return 0;
}
Read about Linked List DS
#include <stdio.h>
#include <stdlib.h>
typedef struct node {
int value;
struct node *next;
} LinkedListNode;
LinkedListNode *createLinkedListNode(int data) {
LinkedListNode *node = (LinkedListNode *)malloc(sizeof(LinkedListNode));
node->next = NULL;
node->value = data;
return node;
}
LinkedListNode *createLL() {
LinkedListNode *a = createLinkedListNode(5);
LinkedListNode *b = createLinkedListNode(1);
LinkedListNode *c = createLinkedListNode(9);
a->next = b;
b->next = c;
return a;
}
int main() {
LinkedListNode *head;
head = createLL();
return 0;
}
Workshop
Pointers, Recursive functions, Memory, LL Data Structure.
C program execution model
Functions
- Abstraction
- Implementation
- Execution
activities
- function declarations
- function executions
- linked list creation
- swap
- array updates