Skip to content

Instantly share code, notes, and snippets.

View thedineshj's full-sized avatar

Din Esh thedineshj

View GitHub Profile
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer-6.0.3/src/Exception.php';
require 'PHPMailer-6.0.3/src/PHPMailer.php';
require 'PHPMailer-6.0.3/src/SMTP.php';
?>
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer-6.0.3/src/Exception.php';
require 'PHPMailer-6.0.3/src/PHPMailer.php';
require 'PHPMailer-6.0.3/src/SMTP.php';
@thedineshj
thedineshj / bubblesort.js
Last active April 21, 2018 07:39
JavaSript code for Bubble sort technique(non optimized version)
function bubbleSort(arr) {
var temp;
console.log("Given array");
console.log(arr);
for (var i = 0; i < arr.length - 1; i++) {
// Last i elements are already in order
for (var j = 0; j < arr.length - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
temp = arr[j];
arr[j] = arr[j + 1];
@thedineshj
thedineshj / bubblesort.js
Last active April 21, 2018 07:51
JavaSript code for Bubble sort technique(optimized version)
function bubbleSort(arr) {
var temp, swapped;
console.log("Given array");
console.log(arr);
for (var i = 0; i < arr.length - 1; i++) {
swapped = false;
// Last i elements are already in order
for (var j = 0; j < arr.length - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
temp = arr[j];
class node {
constructor(data) {
this.data = data;
this.next = null;
}
}
class SingleLinkedList {
constructor() {
this.head = null;
this.length = 0;
}
}
addToHead(data) {
let newNode = new node(data);
/*
If the list is empty ,
newly created `node`
will be the `head` of the list.
*/
if (this.head == null) {
this.head = newNode;
}
addToLast(data) {
let newNode = new node(data);
/*
If the list is empty ,
newly created `node`
will be the `head` of the list.
*/
if (this.head == null) {
this.head = newNode;
insertAfter(key, data) {
/*
If list is empty
*/
if (this.head == null) {
console.log("The list is empty");
}
/*
Travese through the list until `key`
display() {
/*
if list is empty
*/
if (this.head == null) {
console.log('List is empty');
}
/*
Traverse through the list
recursively until `currentnode`