-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
70 lines (57 loc) · 1.97 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using Algorithms.String;
using dsa_csharp.Algorithms.Numeric;
using dsa_csharp.Algorithms.Search;
using dsa_csharp.Algorithms.String;
using dsa_csharp.DataStructure.Queue;
using dsa_csharp.DataStructure.SinglyLinkedList;
using dsa_csharp.DataStructure.Stack;
namespace dsa_csharp;
class Program
{
static void Main(string[] args)
{
// Basic Usage:
// Binary Search
//
// var test = new[]
// {
// 2, 3, 5, 7, 11, 13, 17, 19,
// 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79
// };
//
// Console.WriteLine(BinarySearch.Search(test, 101));
// Basic Usage:
// Boyer-Moore Algorithm
//
// Definition:
//
// This algorithm is one of the popular optimal algorithms
// which is used to find the majority element among the given elements
// that have more than N/2 occurences.
//
// Basic Usage:
//
// var elementCount = 1000;
// var rnd = new Random();
// var randomNums = new List<int>();
// while (randomNums.Count < elementCount / 2) randomNums.Add(rnd.Next(0, elementCount));
// var majorityElement = rnd.Next(0, elementCount);
// randomNums.AddRange(Enumerable.Repeat(majorityElement, elementCount / 2 + 1));
// randomNums = randomNums.OrderBy(x => rnd.Next()).ToList();
// var expected = majorityElement;
// var actual = BoyerMoore<int>.FindMajority(randomNums);
// Console.WriteLine($"Assertion Equals: Actual: {actual} ---- Expected: {expected}");
// var linkedList = new SinglyLinkedList<char>();
// linkedList.AddFirst('H');
// linkedList.AddFirst('E');
// linkedList.AddFirst('L');
// linkedList.AddFirst('L');
// linkedList.AddFirst('O');
// foreach (var list in linkedList.GetListData())
// {
// Console.WriteLine(list);
// }
var isPalindrome = Permutation.GetEveryUniquePermutation("abcd");
foreach (var letrs in isPalindrome) Console.WriteLine(letrs);
}
}