Skip to content

Instantly share code, notes, and snippets.

View kalyandechiraju's full-sized avatar
🎯
Focusing

Kalyan Dechiraju kalyandechiraju

🎯
Focusing
View GitHub Profile
@kalyandechiraju
kalyandechiraju / 0_reuse_code.js
Created August 15, 2017 07:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kalyandechiraju
kalyandechiraju / WeightedQuickUnion.swift
Last active September 13, 2017 15:53
Union Find Algorithm
class WeightedQuickUnion {
// Data Structure to store the values
var id : [Int]? = nil
// Size of connected components
var size : [Int]? = nil
// Initialize the arrays with 0 to n
init(n : Int) {
id = [Int]()
id?.reserveCapacity(n)
@kalyandechiraju
kalyandechiraju / DoublyLinkedList.c
Created September 24, 2017 15:12 — forked from mycodeschool/DoublyLinkedList.c
Doubly Linked List implementation in C
/* Doubly Linked List implementation */
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
struct Node* prev;
};
@kalyandechiraju
kalyandechiraju / BalancedParentheses.cpp
Created October 21, 2017 06:01 — forked from mycodeschool/BalancedParentheses.cpp
C++ Program to check for balanced parentheses in an expression using stack.
/*
C++ Program to check for balanced parentheses in an expression using stack.
Given an expression as string comprising of opening and closing characters
of parentheses - (), curly braces - {} and square brackets - [], we need to
check whether symbols are balanced or not.
*/
#include<iostream>
#include<stack>
#include<string>
using namespace std;
/*
Evaluation Of postfix Expression in C++
Input Postfix expression must be in a desired format.
Operands must be integers and there should be space in between two operands.
Only '+' , '-' , '*' and '/' operators are expected.
*/
#include<iostream>
#include<stack>
#include<string>
@kalyandechiraju
kalyandechiraju / InfixToPostfix.cpp
Created October 21, 2017 06:23 — forked from mycodeschool/InfixToPostfix.cpp
Infix to Postfix conversion in C++ using stack. We are assuming that both operators and operands in input will be single character.
/*
Infix to postfix conversion in C++
Input Postfix expression must be in a desired format.
Operands and operator, both must be single character.
Only '+' , '-' , '*', '/' and '$' (for exponentiation) operators are expected.
*/
#include<iostream>
#include<stack>
#include<string>
/* Queue - Circular Array implementation in C++*/
#include<iostream>
using namespace std;
#define MAX_SIZE 101 //maximum size of the array that will store Queue.
// Creating a class named Queue.
class Queue
{
private:
int A[MAX_SIZE];
@kalyandechiraju
kalyandechiraju / Queue_LinkedList.c
Created October 21, 2017 07:16 — forked from mycodeschool/Queue_LinkedList.c
Linked List implementation of Queue.
/*Queue - Linked List implementation*/
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
};
// Two glboal variables to store address of front and rear nodes.
struct Node* front = NULL;
struct Node* rear = NULL;
/* Binary tree - Level Order Traversal */
#include<iostream>
#include<queue>
using namespace std;
struct Node {
char data;
Node *left;
Node *right;
};
@kalyandechiraju
kalyandechiraju / PreorderInorderPostorder_CPP.cpp
Created October 21, 2017 12:28 — forked from mycodeschool/PreorderInorderPostorder_CPP.cpp
Binary tree traversal: Preorder, Inorder, Postorder
/* Binary Tree Traversal - Preorder, Inorder, Postorder */
#include<iostream>
using namespace std;
struct Node {
char data;
struct Node *left;
struct Node *right;
};