摘要: 点击查看代码 //Linked list reversal using stack #include<iostream> #include<stack>//stack from standard template library(STL) using namespace std; struct no 阅读全文
posted @ 2024-01-19 19:54 bituion 阅读(14) 评论(0) 推荐(0)
摘要: 点击查看代码 //string reversal using stack #include<iostream> #include<stack>//stack from standard template library(STL) using namespace std; void reverse(c 阅读全文
posted @ 2024-01-19 19:18 bituion 阅读(16) 评论(0) 推荐(0)
摘要: 点击查看代码 //Prime factorization of a number #include<iostream> #include<cmath> using namespace std; void primefactorization(int n) { for (int i = 2; i <= 阅读全文
posted @ 2024-01-19 17:14 bituion 阅读(42) 评论(0) 推荐(0)
摘要: 点击查看代码 //Find all factors of a number #include<iostream> #include<cmath> using namespace std; void Factors(int n) { int* factors = new int[n+1](); for 阅读全文
posted @ 2024-01-19 16:09 bituion 阅读(16) 评论(0) 推荐(0)
摘要: 点击查看代码 //Find all prime number upto n-Sieve of Eratosthenes #include<iostream> #include<cmath> using namespace std; void findprimes(int n) { int* prim 阅读全文
posted @ 2024-01-19 15:23 bituion 阅读(17) 评论(0) 推荐(0)
摘要: 点击查看代码 //Verify a prime number-Trial division mothod #include<iostream> #include<cmath> using namespace std; int main() { int n; cin >> n; for (int i 阅读全文
posted @ 2024-01-19 13:32 bituion 阅读(9) 评论(0) 推荐(0)
摘要: 点击查看代码 //Convert a number from decimal to binary #include<iostream> using namespace std; struct node { int data; node* next; }; node* A; void insert(i 阅读全文
posted @ 2024-01-19 13:09 bituion 阅读(14) 评论(0) 推荐(0)
摘要: 点击查看代码 //Quick sort #include<iostream> using namespace std; int partition(int A[],int start,int end) { int pivot = A[end];//默认选取末尾为主元 int pIndex = sta 阅读全文
posted @ 2024-01-19 11:52 bituion 阅读(19) 评论(0) 推荐(0)
摘要: 点击查看代码 //Stack-link list implementation #include<iostream> using namespace std; struct node { int data; node* next; }; node* top; void push(int x) { n 阅读全文
posted @ 2024-01-19 07:51 bituion 阅读(22) 评论(0) 推荐(0)