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
| # Basic implementation of singly linked list | |
| class Node: | |
| def __init__(self, data): | |
| self.data = data | |
| self.next = None | |
| def getData(self): | |
| return self.data | |
| def setData(self, newData): |
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
| # Basic queue implementation: using collections | |
| from collections import deque | |
| class Queue: | |
| def __init__(self): | |
| self.items = deque() | |
| def isEmpty(self): | |
| return self.items == deque([]) |
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
| # Basic stack implementation | |
| class Stack: | |
| def __init__(self): | |
| self.items = list() | |
| def isEmpty(self): | |
| return self.items == [] | |
| def push(self, data): |
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
| # Modified from https://pimylifeup.com/raspberry-pi-distance-sensor | |
| import RPi.GPIO as GPIO | |
| import time | |
| try: | |
| GPIO.setmode(GPIO.BOARD) | |
| PIN_TRIGGER = 7 | |
| PIN_ECHO = 11 |
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
| //Reference: Exploring BeagleBone - Derek Molloy | |
| #include<iostream> | |
| #include<fstream> | |
| #include<string> | |
| #include<sstream> | |
| #include<unistd.h> | |
| using namespace std; | |
| #define LDR_PATH "/sys/bus/iio/devices/iio:device0/in_voltage" |
NewerOlder