Simple C++ Code to Create, Delete and Copy a File in Directory

This program will show how simple it is to create a file, copy all files from one folder to another folder using windows.h and delete files in specific folder. Please post all you doubts and suggestions. #include #include #include #include using namespace std; void _delete1(); void copy(); void create(); int main() { create(); copy(); _delete1();(…)

Read More

Linked List Operations Using Classes in C++

This c++ code shows all operations of linked list in pure Object Oriented Programming. If you want to see the c version of Linked List you can click the link. #include #include using namespace std; class LinkedList { private: struct Node { int data; Node * next; }*List; public: LinkedList(); void append(int number); void addFirst(int(…)

Read More

Difference Between Pointers and Arrays in C++

If you are using arrays in your program, its better to use pointers. Any operation that can be achieved by arrays subscripting can also be achieved by using pointers. Pointers use less memory and also make your program run faster. In array, name of array is the pointe to the first element of that array.(…)

Read More

Inverted Index in Python

Developers: The program is developed by Shahid Siddique & Preetham D Shrinivas. We are students at NYU Poly pursuing Masters in Computer Science. Python code for inverted index   WHAT PROGRAM DOES? The program code which is entirely written in Python has three parts: 1. Parser is the program which parses the pages and return words and(…)

Read More

Focused Crawler and Shopping Bot in Python

Developers Orcun Berkem Shahid Siddique Preetham D Shrinivas INTRODUCTION The aim of our project is to build a focused crawler and a shopping bot. The focused crawler in our project is focused on Books. We decide to do so since we saw websites like Amazon, eBay, Barnes&noble etc have a huge database of books and(…)

Read More

Simple Link-list Operations ( Add, Delete, Insert)

void insertBegin(List **first, int data); void insertEnd(List *first, int data ); void insertAt(List *first, int data, int position); void removeBegin(List *first); void removeEnd(List *first); void removeAt(List *first, int position); int length(List *first); void display(List *head); Above functions are the fundamentals of linked list. To understand linked list one should know at least all of them.(…)

Read More

Counts the Number of Times an Int Occur in a List

#include #include using namespace std; struct Node { Node *next; int data; }; void insertNode( Node *head, int data); int count(Node *myList, int num); void insertNode( Node *head, int data) { Node *newNode = new Node(); newNode -> data = data; newNode -> next = NULL; Node *temp = head; while(temp) { if(temp -> next(…)

Read More

Simple linked list Code to Perform all Operations

This program will show you all the operations on linked list like adding, deleting, searching, inserting etc.. #include using namespace std; struct Node{ int data; Node *next; }; void insertFirst( Node **head, int data) { Node *newHead = new Node(); newHead -> data = data; newHead -> next = *head; *head = newHead; } void(…)

Read More

Find the Frequency of Alphabet in a String

/*Write function compress(char* strSource) it should do the following . repeating chars in sequence should be replaced with char & count, in case count is 1 no need to add any integer. Example – AAAABBBCXYZEEEEPPPPPKKABC should be A4B3CXYZE4P5K2ABC. you are supposed to iterate the array only once, and modify the same input parameter, do not(…)

Read More

Find the Pattern in Reversed String

This function will find the pattern in a reversed string without reversing the string. The trick is start the string from end and pattern from beginning. int reversePattern(char string1[], char pattern[]) { char length1 = strlen(string1); char length2 = strlen(pattern); int i = length1 – 1; int j = length2 – 1; bool flag =(…)

Read More

Find all Positions of Pattern in a string

Very simple function to return all positions of a sub string pattern in a give string. You can use for loop to find all the positions and you can modify to put all the positions in an array which you can pass in parameter. int patternPositionsUsingFor(char string1[], char pattern[], int position) { bool flag =(…)

Read More

String Concatenation Using Pointer

Simple function which takes two strings and concatenate them to new string. This function will take two pointers as a parameter and concatenate them. void concatenateString(char *s1, char *s2) { char stringSum[80]; int i = 0; int length = strlen(s1); while(*s1) { stringSum[i] = *s1; i++; *s1++; } stringSum[i] = ‘ ‘; i++; while(*s2) {(…)

Read More

Replace Pattern in a String with substring

/*17 Answers Given a string…replace all occurances of a with the. eg. A quick brown fox jumped over a bridge on a box. should change to The quick brown fox jumped over the bridge on the box. You cannot use the inbuilt replace function for string manipulation. */ #include using namespace std; void amazonInterview1(char* ch)(…)

Read More

Find the Position of Pattern in a String

This program will find the position of first pattern in a given string. This is very simple c++ code and its for those who have just started learning c++. #include #include using namespace std; void findPatter(char string1[], char pattern[]) { int lenghtString = strlen (string1); int lengthPattern = strlen (pattern); bool flag = false; int(…)

Read More