What do you want to save?
Add Code snippet
New code examples
-
Java 2021-08-27 13:45:01
Mergesort parallelization using Spark
import random import time from pyspark import SparkContext def execute_merge_sort(generated_list): start_time = time.time() sorted_list = merge_sort(generated_list) elapsed = time.time() - start_time print('Simple merge sort: %f sec' % el... Add solution -
Shell/Bash 2021-08-27 10:53:01
bash how to keep one instance of duplicate lines
# Basic syntax: sort input_file | uniq # Sort the file first because uniq requires a sorted file to work. Uniq # then eliminates all duplicated lines in the file, keeping one instance # of each duplicated line Add solution -
Python 2021-08-27 09:55:01
python convert a dict to list or a list to dict or a slice a dict or sort a dict by key or value without import
#convert dict to list or list to dict or slice a dict #1. convert dict to list temp = [] # not required as [] is mentioned below s = {'b': 3, 'a': 2, 'c': 2, 'd': 1, 'e': 1}#our dict remember temp = [[k,v]for k,v in s.items()]# temp is now list print(temp... Add solution