Skip to content

Instantly share code, notes, and snippets.

View mirsahib's full-sized avatar
🎯
Focusing

Mir Habib Ul Latif 🇧🇩 🇵🇸 mirsahib

🎯
Focusing
View GitHub Profile
void insertBeforeParticularItem(int searchVal,int val){
int counter = 0;
if(head == NULL){
cout<<"List is empty"<<endl;
}else{
curr = head;
node* prev = NULL;
while(curr!=NULL){
if(curr->data==searchVal){
node *newNode = new node;
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int row=10, num;
cin>>num;//if you take row as a input the program will have a bug
int *arrayList = new int[row];
@mirsahib
mirsahib / Assignment_4.cpp
Last active October 27, 2017 16:38
double linked list delete function
/*
Author: Mir Sahib
ID: 1510175
Assignment_4
*/
#include <iostream>
using namespace std;
struct node{
int data;
@mirsahib
mirsahib / Stack.cpp
Last active November 4, 2017 14:58
Assignment_5
#include <iostream>
using namespace std;
class Stack{
private:
int top;
int num_array [100];
public:
Stack(){
@mirsahib
mirsahib / Queue.cpp
Created November 4, 2017 14:59
Assignment_5
#include <iostream>
using namespace std;
class Queue{
private:
int Front;
int Rear;
int length;
int num_array[100];
@mirsahib
mirsahib / BST_display_Nth_Largest.cpp
Last active November 20, 2017 11:38
display nth largest element
#include <iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
};
Node* deleteNode(int value,Node* node){
if(node==NULL){
return node;
}else if(value< node->data){
//value is less than node data
node->left = deleteNode(value,node->left);
}else if(value>node->data){
//value is more than node data
node->right = deleteNode(value,node->right);
}else{
int faulty_ball(int n){
if(n==8){
return 3;
}else{
return 1+(n-n/2);
}
}
#include <iostream>
#include <vector>
using namespace std;
vector<string> count_sort(int b[],int s,vector<string>arr,int pass){
string c[10];
for(int i=1;i<10;i++){
b[i]=b[i-1]+b[i];
}
#include <iostream>
using namespace std;
class node{
private:
int cost;
int predecessor;
bool visited;