This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc mergeSort[T](arr: var seq[T]) = | |
# Check if the array has more than one element | |
if arr.len <= 1: | |
return | |
# Calculate mid index | |
let mid = arr.len div 2 | |
# Split the array into two halves | |
var leftHalf = arr[0 ..< mid] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE authors ( | |
author_id INT PRIMARY KEY, | |
name VARCHAR(255) NOT NULL, | |
birth_date DATE | |
); | |
CREATE TABLE books ( | |
book_id INT PRIMARY KEY, | |
title VARCHAR(255) NOT NULL, | |
publication_year INT, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The ReadingRobot class incorrectly attempts to implement | |
# the clean_room method, which is specific to CleaningRobot | |
# and not applicable to ReadingRobot. | |
# This violates the principle of inheritance, where subclasses | |
# should override methods only when they are meant to provide a | |
# different implementation. | |
# To fix this, we can redesign the class hierarchy to separate | |
# the common behavior from the specific behavior more clearly. | |
# One approach is to use composition instead of inheritance, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
int main() { | |
string a[5]; | |
for(int i = 0; i < 5; i++) cin>>a[i]; | |
map <char, string> s; | |
unordered_map <char, vector <char>> first, follow, t; | |
for(int i = 0; i < 5; i++) { | |
cout<<a[i]<<endl; | |
string h=""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
/* Definition Section */ | |
/* You define certain variables in here which you might need to manipulate your code */ | |
%} | |
%% | |
/* Rules Section */ | |
/* Pattern Actions begin */ | |
/* This is a section where you define certain patterns of string (just like RegEx) */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
int n = 0, limit = 0, cursor = 0; | |
char identifiers[100][100]; | |
int identify = 0; | |
%} | |
%% | |
"while"|"if"|"else"|"for" {n++;printf("\t keywords : %s\n", yytext);} |