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
public class EventAggregator | |
{ | |
private readonly Dictionary<string, IList<Action<object>>> _events; | |
public EventAggregator() | |
{ | |
_events = new Dictionary<string, IList<Action<object>>>(); | |
} | |
public void Subscribe(string eventKey, Action<object> handler) |
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
namespace MartinAssignment | |
{ | |
/// <summary> | |
/// Create a collection that implements the following interface | |
/// The constructor should have the following signature: | |
/// NumberCollection(int[] values); | |
/// NumberCollection(int size); | |
/// </summary> | |
public interface INumberCollection | |
{ |
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
public class Arrays | |
{ | |
public bool Find(int[] list, int value) | |
{ | |
for (int i = 0; i < list.Length; i++) | |
{ | |
if (list[i] == value) return true; | |
} | |
return false; |
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
public interface ITweenObject | |
{ | |
float CompletionTime { get; } | |
float TimeUntilNextTween { get; } | |
void ExecuteTween(); | |
} |
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
/* | |
* Write a program that, given the root node of a tree, returns the sum of all its children. | |
* | |
* Example, given the following tree: | |
* 50 | |
* / \ | |
* 20 30 | |
* / \ | |
* 70 80 | |
* The algorithm should return 250 ( 50 + 20 + 30 + 70 + 80 ) |
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
void Main() | |
{ | |
int[][] arguments = new int[][] | |
{ | |
new int[] {4,5,1,3}, | |
new int[] {13,27,18,26}, | |
new int[] {32,35,37,39}, | |
new int[] {1000, 1001, 857,1} | |
}; | |
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
for(i = 0; i < n; i++) { | |
//create 2 pipes per process, then close appropriate ends | |
if(pipe(parent_to_child[i]) == -1) { | |
cout << "Error creating pipe!" << endl; | |
exit(1); | |
} | |
if(pipe(child_to_parent[i]) == -1) { | |
cout << "Error creating pipe!" << endl; | |
exit(1); |
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
return new Dictionary<string, dynamic>() | |
{ | |
{"firstName", firstName}, | |
{"lastName", lastName}, | |
{"ssn", ssn}, | |
{"allEvaluationsPassed", allTestsPassed}, | |
{"reasons", !allTestsPassed ? failureList : null} | |
} | |
.Where(entry => entry.Value != null) | |
.ToDictionary(k => k.Key, v => v.Value); |
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 <iostream> | |
#include <fstream> | |
#include <string> | |
#include <ctime> | |
#include <cstdlib> | |
#include <time.h> | |
#include "VirtualMemoryManager.h" | |
using namespace std; |
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
for(int i = 0; i < frames_per_process; i++) { | |
int cur_frame = frames_per_process*pid_offset + i; | |
if(ram[cur_frame] == -1) { | |
//empty slot found in ram | |
return cur_frame; | |
} | |
} |
NewerOlder