This file contains hidden or 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
trait Component { | |
val childrens = new collection.mutable.ArrayBuffer[Component]() | |
//val parent: Component | |
def operation: Unit | |
def add(component: Component) = () | |
def remove(component: Component) = () | |
def getChildrens: Iterator[Component] = collection.Iterator.empty | |
} |
This file contains hidden or 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 <assert.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
void *malloc(size_t size) { | |
void *p = sbrk(0); | |
void *request = sbrk(size); | |
if (request == (void*) -1) { |
This file contains hidden or 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
<html> | |
<head> | |
<title>Gantt chart</title> | |
<style type="text/css"> | |
.process { | |
} | |
#input { | |
} | |
#add-process-button { |
This file contains hidden or 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
def nQueens(n: Int) = (0 until n).permutations filter {p => | |
val i = p.zipWithIndex.toSet // p[i] is the column of the queen on ith row (must be a permutation of 0 until n) | |
i.map{case (c, d) => c + d}.size == n && // No 2 queens can have same col + diag | |
i.map{case (c, d) => c - d}.size == n // No 2 queens can have same col - diag | |
} | |
for { | |
(solution, num) <- nQueens(8).zipWithIndex | |
_ = println(s"Solution #${num + 1}:") | |
col <- solution |
This file contains hidden or 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
package com.github.shkesar.JMusic; | |
import javafx.application.Application; | |
import javafx.scene.Scene; | |
import javafx.scene.control.*; | |
import javafx.scene.layout.BorderPane; | |
import javafx.scene.layout.HBox; | |
import javafx.scene.layout.VBox; | |
import javafx.scene.media.Media; | |
import javafx.scene.media.MediaPlayer; |
This file contains hidden or 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
import nltk | |
nltk.download('stopwords') |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | |
<title>Notes</title> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
#define MAX_LEN 1024 | |
int main(int argc, char const *argv[]) | |
{ | |
char *plain = malloc(MAX_LEN * sizeof(int)); | |
char *pass = malloc(MAX_LEN * sizeof(int)); |
This file contains hidden or 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 <stdlib.h> | |
#include <stdio.h> | |
#include <ctype.h> | |
int data_validation(char *fmt, char *data) { | |
while (*data) { | |
if (*fmt == 'a' && !isalpha(*data)) return 0; | |
else if (*fmt == 'n' && !isdigit(*data)) return 0; | |
else if (*fmt == 'x' && !isalnum(*data)) return 0; | |
else if (*fmt == '*') return 1; |
This file contains hidden or 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
no = int(input()) | |
students = [] | |
for i in range(no): | |
name = str(raw_input("Enter name: ")) | |
marks = float(raw_input("Enter marks: ")) | |
students.append([name, marks]) | |
smallest = min(students, key=lambda x: x[1]) |