Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions submissions/2018955_task01/2018955_task01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include<bits/stdc++.h>

using namespace std;

int main()
{
int arr1[1000], arr2[1000], conArr[2000];

int n1, n2;

int i, x;

cout<<"Enter the Size for First Array : ";

cin>>n1;

cout<<endl;

cout<<"Enter elements for First Array : ";

for(i=0; i<n1; i++)
{
cin>>arr1[i];

conArr[i] = arr1[i];
}

x = i;

cout<<endl;

cout<<"Enter the Size for Second Array : ";

cin>>n2;

cout<<endl;

cout<<"Enter elements for Second Array : ";

for(i=0; i<n2; i++)
{
cin>>arr2[i];

conArr[x] = arr2[i];

x++;
}

cout<<endl;

cout<<"Array after concatenation : ";

for(i=0; i<x; i++)
{
cout<<conArr[i]<<" ";
}

return 0;

}
88 changes: 88 additions & 0 deletions submissions/2018955_task02/2018955_task02.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#include<bits/stdc++.h>

using namespace std;

struct node
{
int data;

struct node *next;
};

void push(struct node **head_ref, int data)
{
struct node *node;

node = (struct node*)malloc(sizeof(struct node));

node->data = data;

node->next = (*head_ref);

(*head_ref) = node;
}

void reverse(struct node **head_ref)
{
struct node *temp = NULL;

struct node *prev = NULL;

struct node *current = (*head_ref);

while(current != NULL)
{
temp = current->next;

current->next = prev;

prev = current;

current = temp;
}

(*head_ref) = prev;

}

void printnodes(struct node *head)
{
while(head != NULL)
{
cout<<head->data<<" ";

head = head->next;
}
}


int main()
{
struct node *head = NULL;

push(&head, 45);

push(&head, 23);

push(&head, 98);

push(&head, 12);

push(&head, 36);

push(&head, 84);

cout << "List before reversing" << endl;

printnodes(head);

reverse(&head);

cout << endl;

cout << "List after reversing"<<endl;

printnodes(head);

return 0;
}