๐ป I'm currently working on:
Building AI-powered applications including a Sentiment Intelligence Engine with 18+ ML models and real-time recommendation systems.
๐ค I'm looking to collaborate on:
Open-source AI/ML projects, data-driven applications, and full-stack ML systems using FastAPI + React.
๐ ๏ธ I'm looking for help with:
Scaling ML models, improving deployment pipelines, and optimizing recommendation systems.
๐ฑ I'm currently learning:
Advanced Machine Learning, NLP, and system design for AI applications.
๐ฌ Ask me about:
Machine Learning, Data Analysis, Sentiment Analysis, and building AI projects from scratch.
โก Fun fact:
I built a multi-domain AI platform before finishing my first year of engineering.
Youโve got a full DAA lab chunk here. Iโll give you clean C++ code + sample output for each (Lab 9โ15). No fluff.
โ Lab 9: Longest Common Subsequence (LCS)
Code
#include #include using namespace std;
int lcs(string X, string Y) { int m = X.length(), n = Y.length(); vector<vector> dp(m+1, vector(n+1, 0));
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
if(X[i-1]==Y[j-1])
dp[i][j]=1+dp[i-1][j-1];
else
dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
}
}
return dp[m][n];
}
int main() { string X = "ABCBDAB", Y = "BDCAB"; cout << "LCS Length: " << lcs(X,Y); }
Output
LCS Length: 4
โ Lab 10: N-Queens Problem
Code
#include using namespace std;
#define N 4
bool isSafe(int board[N][N], int row, int col) { for(int i=0;i<col;i++) if(board[row][i]) return false;
for(int i=row,j=col;i>=0 && j>=0;i--,j--)
if(board[i][j]) return false;
for(int i=row,j=col;j>=0 && i<N;i++,j--)
if(board[i][j]) return false;
return true;
}
bool solve(int board[N][N], int col) { if(col>=N) return true;
for(int i=0;i<N;i++){
if(isSafe(board,i,col)){
board[i][col]=1;
if(solve(board,col+1)) return true;
board[i][col]=0;
}
}
return false;
}
int main(){ int board[N][N]={0};
if(solve(board,0)){
for(int i=0;i<N;i++){
for(int j=0;j<N;j++)
cout<<board[i][j]<<" ";
cout<<endl;
}
}
}
Output
0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0
โ Lab 11: Travelling Salesman Problem (TSP - brute force)
Code
#include #include using namespace std;
#define N 4
int tsp(int graph[N][N], bool visited[], int curr, int count, int cost, int &ans) { if(count == N && graph[curr][0]) { ans = min(ans, cost + graph[curr][0]); return ans; }
for(int i=0;i<N;i++){
if(!visited[i] && graph[curr][i]){
visited[i]=true;
tsp(graph,visited,i,count+1,cost+graph[curr][i],ans);
visited[i]=false;
}
}
return ans;
}
int main(){ int graph[N][N]={ {0,10,15,20}, {10,0,35,25}, {15,35,0,30}, {20,25,30,0} };
bool visited[N]={false};
visited[0]=true;
int ans = INT_MAX;
cout<<"Minimum cost: "<<tsp(graph,visited,0,1,0,ans);
}
Output
Minimum cost: 80
โ Lab 12: BFS and DFS
Code
#include #include #include using namespace std;
void BFS(vector<vector>& adj, int start) { vector visited(adj.size(), false); queue q;
q.push(start);
visited[start] = true;
while(!q.empty()){
int node = q.front(); q.pop();
cout << node << " ";
for(int i: adj[node]){
if(!visited[i]){
visited[i]=true;
q.push(i);
}
}
}
}
void DFS(vector<vector>& adj, int node, vector& visited){ visited[node]=true; cout<<node<<" ";
for(int i: adj[node]){
if(!visited[i])
DFS(adj,i,visited);
}
}
int main(){ vector<vector> adj = { {1,2}, {0,3}, {0,3}, {1,2} };
cout<<"BFS: ";
BFS(adj,0);
cout<<"\nDFS: ";
vector<bool> visited(4,false);
DFS(adj,0,visited);
}
Output
BFS: 0 1 2 3 DFS: 0 1 3 2
โ Lab 13: Randomized Quick Sort
Code
#include #include using namespace std;
int partition(int arr[], int low, int high){ int pivot = arr[high]; int i = low - 1;
for(int j=low;j<high;j++){
if(arr[j] < pivot){
i++;
swap(arr[i],arr[j]);
}
}
swap(arr[i+1],arr[high]);
return i+1;
}
void quickSort(int arr[], int low, int high){ if(low < high){ int pi = partition(arr,low,high); quickSort(arr,low,pi-1); quickSort(arr,pi+1,high); } }
int main(){ int arr[]={10,7,8,9,1,5}; int n=6;
quickSort(arr,0,n-1);
for(int i=0;i<n;i++)
cout<<arr[i]<<" ";
}
Output
1 5 7 8 9 10
โ Reality check (important)
This is NOT randomized quicksort. This is normal quicksort.
If examiner is strict โ youโll lose marks.
Fix (true random pivot)
Replace:
int pivot = arr[high];
with:
int random = low + rand() % (high - low); swap(arr[random], arr[high]); int pivot = arr[high];
โ Lab 14: String Matching (Naive)
Code
#include using namespace std;
void search(string txt, string pat){ int n = txt.length(); int m = pat.length();
for(int i=0;i<=n-m;i++){
int j;
for(j=0;j<m;j++){
if(txt[i+j]!=pat[j])
break;
}
if(j==m)
cout<<"Pattern found at index "<<i<<endl;
}
}
int main(){ string txt="AABAACAADAABAABA"; string pat="AABA";
search(txt,pat);
}
Output
Pattern found at index 0 Pattern found at index 9 Pattern found at index 12
โ Lab 15: Real-Time Problem Discussion (Example: Shortest Path)
You donโt write theory only โ better show code example.
Code (Dijkstra)
#include #include #include using namespace std;
int minDist(vector& dist, vector& vis){ int min=INT_MAX, index; for(int i=0;i<dist.size();i++){ if(!vis[i] && dist[i]<=min){ min=dist[i]; index=i; } } return index; }
void dijkstra(vector<vector>& graph){ int V = graph.size(); vector dist(V, INT_MAX); vector vis(V,false);
dist[0]=0;
for(int i=0;i<V-1;i++){
int u = minDist(dist,vis);
vis[u]=true;
for(int v=0;v<V;v++){
if(!vis[v] && graph[u][v] && dist[u]!=INT_MAX &&
dist[u]+graph[u][v] < dist[v]){
dist[v] = dist[u]+graph[u][v];
}
}
}
for(int i=0;i<V;i++)
cout<<"Distance "<<i<<": "<<dist[i]<<endl;
}
int main(){ vector<vector> graph={ {0,4,0,0,0,0,0,8,0}, {4,0,8,0,0,0,0,11,0}, {0,8,0,7,0,4,0,0,2}, {0,0,7,0,9,14,0,0,0}, {0,0,0,9,0,10,0,0,0}, {0,0,4,14,10,0,2,0,0}, {0,0,0,0,0,2,0,1,6}, {8,11,0,0,0,0,1,0,7}, {0,0,2,0,0,0,6,7,0} };
dijkstra(graph);
}
Output (shortened)
Distance 0: 0 Distance 1: 4 Distance 2: 12 ...
Donโt just submit โ understand at least 3 properly (LCS, BFS/DFS, QuickSort)
Viva will destroy you if you canโt explain:
Time complexity
Why DP used (LCS)
Difference BFS vs DFS
Why greedy fails in TSP
If you want, Iโll compress this into a single .cpp file or give viva answers + theory sheet.
