Hi please help me with this program in C language This progr
Solution
using System;
using System.Collections.Generic;
namespace LinkedList
{
class Program
{
static void Main(string[] args)
{
List<int> a = new List<int>();
a.Add(1);
a.Add(2);
a.Add(5);
a.Add(6);
int value = 5;
switch (value)
{
case 1:
SortedInsert(5, a, a.Count);
break;
case 2:
SortedInsert(7, a, a.Count);
break;
case 3:
SortedInsert(9, a, a.Count);
break;
case 4:
SortedInsert(11, a, a.Count);
break;
case 5:
SortedInsert(5, a, a.Count);
break;
case 6:
foreach (int i in a)
{
Console.WriteLine(i);
}
break;
case 7:
SortedInsert(7, a, a.Count);
break;
case 8:
foreach (int i in a)
{
Console.WriteLine(i);
}
break;
case 9:
SortedSearchPosition(a, 3);
break;
case 10:
SortedFind(a, 7);
break;
case 11:
Console.WriteLine(SortedGetLength(a));
break;
case 12:
SortedDelete(7, a);
break;
case 13:
foreach (int i in a)
{
Console.WriteLine(i);
}
break;
case 14:
SortedFind(a, 7);
break;
}
}
public static bool SortedIsEmpty(List<int> a)
{
if (a.Count == 0)
return false;
else
return true;
}
public static int SortedGetLength(List<int> a)
{
return a.Count;
}
public static bool SortedSearchPosition(List<int> a, int k)
{
if (a.Count != 0)
{
return true;
//if (a.Find(k))
//{
//}
}
return false;
}
public static int SortedFind(List<int> a, int k)
{
int element = 0;
if (a.Count != 0)
{
return element;
//if (a.Find(k))
//{
//}
}
return element;
}
public static bool SortedInsert(int x, List<int> a, int position)
{
a.Insert(position, x);
return true;
}
public static bool SortedDelete(int k, List<int> a)
{
a.Remove(k);
return true;
}
}
}


