This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Stack implemetation using linked list */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| struct node { | |
| int data; | |
| struct node *next; | |
| }; | |
| struct node *createNode(int data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Que implementation using linked list */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| struct node { | |
| int data; | |
| struct node *next; | |
| }; | |
| struct node *createNode(int data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| void swap(int *a, int *b) { | |
| int tmp = *a; | |
| *a = *b; | |
| *b = tmp; | |
| } | |
| int partition(int *a, int l, int h) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Sliding window algorithm | |
| * | |
| * Implementation of the examples from: | |
| * https://leetcode.com/explore/interview/card/leetcodes-interview-crash-course-data-structures-and-algorithms/703/arraystrings/4502/ | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| // Find the longest sub-array that has |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| int main(int argc, char **argv) { | |
| if (argc < 2) | |
| fprintf(stderr, "Please provide a string\n"); | |
| const char *w = argv[1]; | |
| int i = 0; | |
| int j = strlen(w)-1; | |
| while (i < j) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Graphics; | |
| import java.awt.Color; | |
| import java.awt.Canvas; | |
| import javax.swing.JFrame; | |
| public class life { | |
| public static void main(String[] args) { | |
| String title = "Conway's Game of Life"; | |
| Conway game = new Conway(); | |
| JFrame frame = new JFrame(title); |